//
//  ParameterCollectionViewCell.swift
//  koolcar
//
//  Created by kuaimaxiansheng on 2023/10/17.
//

import UIKit

class ParameterCollectionViewCell: UICollectionViewCell {
    var imageView: UIImageView!
    var titleLab: UILabel!
    var contentLab: UILabel!
    
    override init(frame: CGRect){
        super.init(frame: frame)
        self.backgroundColor = .white
        self.addInitSubview()
        self.addLauout()
    }
    
    func addInitSubview() {
        
        self.imageView = UIImageView(frame: .zero)
        self.contentView.addSubview(self.imageView)
        
        self.titleLab = UILabel(frame: CGRect(x: 0, y: 15, width: kScreenWidth/4, height: 20))
        self.titleLab.textColor = UIColor.init(hex: 0x939AA8)
        self.titleLab.font = UIFont.init(name: Theme.PingFangSCRegular, size: 12)
        self.titleLab.textAlignment = .center
        self.contentView.addSubview(self.titleLab)
        
        self.contentLab = UILabel(frame: CGRect(x: 0, y: self.titleLab.bottom + 5, width: kScreenWidth/4, height: 20))
        self.contentLab.textColor = Theme.titleLabColor
        self.contentLab.font = UIFont.init(name: Theme.PingFangSCMedium, size: 12)
        self.contentLab.textAlignment = .center
        self.contentView.addSubview(self.contentLab)
     
        
        
    }
    
    func addLauout() {
        
        self.imageView.snp.makeConstraints { make in
            make.top.equalTo(13)
            make.centerX.equalTo(self.contentView.snp.centerX)
            make.width.equalTo(25)
            make.height.equalTo(24)
            
        }
        
        self.titleLab.snp.makeConstraints{ make in
            make.top.equalTo(self.imageView.snp.bottom).offset(0)
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.height.equalTo(20)
        }
             
        self.contentLab.snp.makeConstraints{ make in
            make.top.equalTo(self.titleLab.snp.bottom).offset(0)
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.height.greaterThanOrEqualTo(20)
        }
     
    }
    
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
